package com.ibeeking.found.common.enums.member;

/**
 * @Author ibeeking
 * @Date: 2021-01-05 19:15
 * @Description: 权益内容字段 enum
 */
public enum MemberLevelChangeRuleFieldEnum {
    /**
     * 升级条件关系(1或 2且)
     */
    UP_AND_OR("upAndOr", "升级条件关系"),
    /**
     * 升级策略-日累计消费
     */
    UP_DAY_COST_AMOUNT("upDayCostAmount", "日累计消费"),
    /**
     * 升级策略-年累计消费
     */
    UP_YEAR_COST_AMOUNT("upYearCostAmount", "年累计消费"),
    /**
     * 保级策略-获得等级多少个月后
     */
    KEEP_MONTH_NUM("keepMonthNum", "获得等级"),
    /**
     * 保级策略-年累计消费
     */
    KEEP_YEAR_COST_AMOUNT("keepYearCostAmount", "年累计消费"),;


    private String code;
    private String desc;

    MemberLevelChangeRuleFieldEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }


    public static MemberLevelChangeRuleFieldEnum getEnumByCode(String code) {
        for (MemberLevelChangeRuleFieldEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }

    public static String getDescByCode(String code) {
        for (MemberLevelChangeRuleFieldEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getDesc();
            }
        }
        return null;
    }
}
